package com.googlecode.ocl2sqlcompiler;

import java.io.FileReader;

/**
 * 
 * @author Renato Miceli
 * 
 */
public class OCLCompiler {

	private final String oclInputFile;
	private final String xmiInputFile;

	public OCLCompiler(String oclInputFile, String xmiInputFile) {
		this.oclInputFile = oclInputFile;
		this.xmiInputFile = xmiInputFile;
	}

	public void analyze() throws Exception {
		XMIParser.getInstance(xmiInputFile);
		OCLParser ocl = new OCLParser(new OCLScanner(new FileReader(
				oclInputFile)));
		ocl.parse();
	}

	public static void main(String[] args) throws Exception {

		if (args.length != 2) {
			System.err.println("USAGE: <ocl_input_file> <xmi_input_file>");
			System.exit(1);
		}

		final String oclInputFile = args[0];
		final String xmiInputFile = args[1];

		OCLCompiler compiler = new OCLCompiler(oclInputFile, xmiInputFile);
		compiler.analyze();
	}

}
